/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Visao;

import Controle.SalaController;
import Controle.SessaoController;
import Modelo.Sala;
import Modelo.TableModelSala;
import Modelo.TableModelSessao;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableModel;

/**
 *
* @author andreus & gabriel
 */
public class CinemaGUI extends javax.swing.JFrame {

     private SalaController controleSala;
     private TableModelSala modelSala;
     private SessaoController controleSessao;
     private TableModelSessao modelSessao;
     private Sala salaSelecionada;
     
    /**
     * Creates new form CinemaGUI
     */
    public CinemaGUI() {
        initComponents();
        modelSala = new TableModelSala();
        tblSala.setModel(modelSala);
        modelSessao = new TableModelSessao();
        tblSessao.setModel(modelSessao);
        tblVendas.setModel(modelSessao);
        controleSala = new SalaController(this, modelSala);
        controleSessao = new SessaoController(this, modelSessao);
        Thread Banner = new Thread(new runBanner(banner));
        Banner.start();
    }

    public JComboBox getCmbSala() {
        return cmbSala;
    }

    public JTextField getTxtData() {
        return txtData;
    }
    
    public JTable getTableVendas(){
        return tblVendas;
    }

    public JTextField getTxtHora() {
        return txtHora;
    }

    public JTextField getTxtIngressos() {
        return txtIngressos;
    }

    public JTextField getTxtLotacao() {
        return txtLotacao;
    }

    public JTextField getTxtNomeFilme() {
        return txtNomeFilme;
    }

    public JTextField getTxtNroSala() {
        return txtNroSala;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tpnPrincipal = new javax.swing.JTabbedPane();
        pnlSessao = new javax.swing.JPanel();
        ifrSessao = new javax.swing.JInternalFrame();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtIngressos = new javax.swing.JTextField();
        txtHora = new javax.swing.JTextField();
        txtData = new javax.swing.JTextField();
        txtNomeFilme = new javax.swing.JTextField();
        cmbSala = new javax.swing.JComboBox();
        btnAddSessao = new javax.swing.JButton();
        btnRemoveSessao = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblSessao = new javax.swing.JTable();
        pnlSala = new javax.swing.JPanel();
        ifrSala = new javax.swing.JInternalFrame();
        lblNroSala = new javax.swing.JLabel();
        txtNroSala = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        txtLotacao = new javax.swing.JTextField();
        btnAddSala = new javax.swing.JButton();
        btnRemoveSala = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblSala = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        ifrVendas = new javax.swing.JInternalFrame();
        btnRelatorio = new javax.swing.JButton();
        btnVender = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblVendas = new javax.swing.JTable();
        banner = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Cinema");
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));
        setResizable(false);
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

        tpnPrincipal.setName(""); // NOI18N

        ifrSessao.setTitle("Sessão");
        ifrSessao.setVisible(true);

        jLabel2.setText("Nome do Filme:");

        jLabel3.setText("Data:");

        jLabel4.setText("Nº. da Sala:");

        jLabel5.setText("Horário:");

        jLabel6.setText("Vendas:");

        txtIngressos.setText("0");
        txtIngressos.setEnabled(false);
        txtIngressos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtIngressosActionPerformed(evt);
            }
        });

        cmbSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbSalaActionPerformed(evt);
            }
        });

        btnAddSessao.setText("Adicionar");
        btnAddSessao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddSessaoActionPerformed(evt);
            }
        });

        btnRemoveSessao.setText("Remover");
        btnRemoveSessao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRemoveSessaoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout ifrSessaoLayout = new javax.swing.GroupLayout(ifrSessao.getContentPane());
        ifrSessao.getContentPane().setLayout(ifrSessaoLayout);
        ifrSessaoLayout.setHorizontalGroup(
            ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ifrSessaoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtNomeFilme)
                    .addGroup(ifrSessaoLayout.createSequentialGroup()
                        .addGroup(ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ifrSessaoLayout.createSequentialGroup()
                                .addComponent(cmbSala, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(24, 24, 24)
                                .addComponent(jLabel6)
                                .addGap(29, 29, 29)
                                .addGroup(ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(ifrSessaoLayout.createSequentialGroup()
                                        .addComponent(txtIngressos, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(btnRemoveSessao, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(ifrSessaoLayout.createSequentialGroup()
                                        .addComponent(txtHora, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(btnAddSessao, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(ifrSessaoLayout.createSequentialGroup()
                                .addComponent(txtData, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(78, 78, 78)
                                .addComponent(jLabel5)))
                        .addGap(0, 2, Short.MAX_VALUE)))
                .addContainerGap())
        );
        ifrSessaoLayout.setVerticalGroup(
            ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ifrSessaoLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtNomeFilme, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(txtHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnAddSessao))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ifrSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(cmbSala, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(txtIngressos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnRemoveSessao))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        tblSessao.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tblSessao.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblSessaoMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tblSessao);

        javax.swing.GroupLayout pnlSessaoLayout = new javax.swing.GroupLayout(pnlSessao);
        pnlSessao.setLayout(pnlSessaoLayout);
        pnlSessaoLayout.setHorizontalGroup(
            pnlSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ifrSessao)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
        );
        pnlSessaoLayout.setVerticalGroup(
            pnlSessaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSessaoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ifrSessao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE))
        );

        tpnPrincipal.addTab("Cadastro de Sessões", pnlSessao);

        ifrSala.setTitle("Sala");
        ifrSala.setVisible(true);

        lblNroSala.setText("Nº. da Sala:");

        jLabel1.setText("Lotação:");

        btnAddSala.setText("Adicionar");
        btnAddSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddSalaActionPerformed(evt);
            }
        });

        btnRemoveSala.setText("Remover");
        btnRemoveSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRemoveSalaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout ifrSalaLayout = new javax.swing.GroupLayout(ifrSala.getContentPane());
        ifrSala.getContentPane().setLayout(ifrSalaLayout);
        ifrSalaLayout.setHorizontalGroup(
            ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ifrSalaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblNroSala)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtNroSala, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)
                    .addComponent(txtLotacao))
                .addGap(18, 18, 18)
                .addGroup(ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnAddSala, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnRemoveSala, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        ifrSalaLayout.setVerticalGroup(
            ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ifrSalaLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtNroSala)
                        .addComponent(btnAddSala))
                    .addComponent(lblNroSala, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addGroup(ifrSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtLotacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnRemoveSala)))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        tblSala.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        tblSala.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblSalaMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tblSala);

        javax.swing.GroupLayout pnlSalaLayout = new javax.swing.GroupLayout(pnlSala);
        pnlSala.setLayout(pnlSalaLayout);
        pnlSalaLayout.setHorizontalGroup(
            pnlSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ifrSala)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 617, Short.MAX_VALUE)
        );
        pnlSalaLayout.setVerticalGroup(
            pnlSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSalaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ifrSala, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
                .addGap(6, 6, 6))
        );

        tpnPrincipal.addTab("Cadastro de Salas", pnlSala);

        ifrVendas.setTitle("Sessões Disponíveis");
        ifrVendas.setVisible(true);

        btnRelatorio.setText("Gerar Relatório");
        btnRelatorio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRelatorioActionPerformed(evt);
            }
        });

        btnVender.setText("Registrar Venda");
        btnVender.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVenderActionPerformed(evt);
            }
        });

        tblVendas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        tblVendas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblVendasMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tblVendas);

        javax.swing.GroupLayout ifrVendasLayout = new javax.swing.GroupLayout(ifrVendas.getContentPane());
        ifrVendas.getContentPane().setLayout(ifrVendasLayout);
        ifrVendasLayout.setHorizontalGroup(
            ifrVendasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ifrVendasLayout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ifrVendasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnRelatorio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnVender, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ifrVendasLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(banner, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        ifrVendasLayout.setVerticalGroup(
            ifrVendasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ifrVendasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ifrVendasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE)
                    .addGroup(ifrVendasLayout.createSequentialGroup()
                        .addComponent(btnRelatorio)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnVender)
                        .addGap(18, 18, 18)
                        .addComponent(banner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ifrVendas)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ifrVendas)
        );

        tpnPrincipal.addTab("Vendas", jPanel1);

        getContentPane().add(tpnPrincipal);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtIngressosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtIngressosActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtIngressosActionPerformed

    private void btnAddSessaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddSessaoActionPerformed
        // TODO add your handling code here:
        controleSessao.insert();
    }//GEN-LAST:event_btnAddSessaoActionPerformed

    private void btnAddSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddSalaActionPerformed
        // TODO add your handling code here:
        controleSala.insert();
    }//GEN-LAST:event_btnAddSalaActionPerformed

    private void btnRemoveSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveSalaActionPerformed
        // TODO add your handling code here:
        controleSala.remove();
    }//GEN-LAST:event_btnRemoveSalaActionPerformed

    private void tblSalaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblSalaMouseClicked
        // TODO add your handling code here:
        controleSala.select();
    }//GEN-LAST:event_tblSalaMouseClicked

    private void btnRemoveSessaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveSessaoActionPerformed
        // TODO add your handling code here:
        controleSessao.remove();
    }//GEN-LAST:event_btnRemoveSessaoActionPerformed

    private void tblSessaoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblSessaoMouseClicked
        // TODO add your handling code here:
        controleSessao.select();
    }//GEN-LAST:event_tblSessaoMouseClicked

    private void btnVenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVenderActionPerformed
        // TODO add your handling code here:
        controleSessao.update();
    }//GEN-LAST:event_btnVenderActionPerformed

    private void tblVendasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblVendasMouseClicked
        // TODO add your handling code here:
        controleSessao.select();
    }//GEN-LAST:event_tblVendasMouseClicked

    private void btnRelatorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRelatorioActionPerformed
        try {
            // TODO add your handling code here:
            controleSessao.print();
        } catch (IOException ex) {
            Logger.getLogger(CinemaGUI.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnRelatorioActionPerformed

    private void cmbSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbSalaActionPerformed
        // TODO add your handling code here:
        salaSelecionada = modelSala.search(Integer.parseInt(cmbSala.getSelectedItem().toString()));
    }//GEN-LAST:event_cmbSalaActionPerformed
    
    public  Sala getSalaSeleciona(){
        return this.salaSelecionada;
    }
    
    public JTable getTableSalas(){
        return tblSala;
    }
    
    public JTable getTableSessoes(){
        return tblSessao;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel banner;
    private javax.swing.JButton btnAddSala;
    private javax.swing.JButton btnAddSessao;
    private javax.swing.JButton btnRelatorio;
    private javax.swing.JButton btnRemoveSala;
    private javax.swing.JButton btnRemoveSessao;
    private javax.swing.JButton btnVender;
    private javax.swing.JComboBox cmbSala;
    private javax.swing.JInternalFrame ifrSala;
    private javax.swing.JInternalFrame ifrSessao;
    private javax.swing.JInternalFrame ifrVendas;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JLabel lblNroSala;
    private javax.swing.JPanel pnlSala;
    private javax.swing.JPanel pnlSessao;
    private javax.swing.JTable tblSala;
    private javax.swing.JTable tblSessao;
    private javax.swing.JTable tblVendas;
    private javax.swing.JTabbedPane tpnPrincipal;
    private javax.swing.JTextField txtData;
    private javax.swing.JTextField txtHora;
    private javax.swing.JTextField txtIngressos;
    private javax.swing.JTextField txtLotacao;
    private javax.swing.JTextField txtNomeFilme;
    private javax.swing.JTextField txtNroSala;
    // End of variables declaration//GEN-END:variables
}
